import React, { Component } from 'react'

export class Test extends Component {
  render() {
    return (
      <>
        <div>Test</div>
        <hr />
        <TestSon name='aa1a'></TestSon>
        <hr />
        <TestSon2 name='bbb'></TestSon2>
      </>
    )
  }
}
export class TestSon extends Component {
  // 默认实现了此方法可以不写
  // constructor(props) {
  //   super(props)
    
  // }

  render() {
    console.log(this.props)
    return (
      <>
        <div>TestSon</div>
        <span>class组件父组件穿过来的props： {this.props.name}</span>
      </>
    )
  }
}

export function TestSon2(props) {
  return <div>函数式组件props：{props.name}</div>
}
